﻿<%@ WebHandler Language="C#" Class="ProductType_Del" %>

using System;
using System.Web;
using Newtonsoft.Json;

//ADD BY DZT
//System.Web.SessionState.IReadOnlySessionState 增加这个接口类，SESSION可以直接访问
public class ProductType_Del : IHttpHandler , System.Web.SessionState.IReadOnlySessionState 
{    
    OTS.BLL.ProductTypeBLL dll = new OTS.BLL.ProductTypeBLL();
    public void ProcessRequest(HttpContext context)
    {
        //检验是否登录
                //检验是否登录
        OTS.Common.PageSuccess page = new OTS.Common.PageSuccess();
        if (!OTS.BaseLogin.validataModule(context, (int)OTS.enumSysRight.ProductTypeManager))
        {
            page.success = false;
            page.msg = "非法操作！";

        }
        else
        {
            string id = context.Request["id"]; 
            if (null != id && !"".Equals(id))
            {
                if (dll.Delete(Int32.Parse(id)))
                {
                    page.success = true;
                    page.msg = "删除成功！";
                }
                else
                {
                    page.success = false;
                    page.msg = "参数错误！注意自系统定义的不能被删除！";
                } 
                
                
            }
            else
            {
                page.success = false;
                page.msg = "参数有误！";

            }
        }

        context.Response.ContentType = "application/x-json";
        context.Response.Charset = "utf-8";
        context.Response.Write(JavaScriptConvert.SerializeObject(page));
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}